package com.jz.beijianbao.beijian.mapper;

import com.jz.beijianbao.beijian.bean.*;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface BeiJianMapper {


    List<BeiJian> queryPage(BeiJianSelectVo beiJianSelectVo);


    int count(BeiJianSelectVo beiJianSelectVo);


    @Insert("insert into beijian (name,code,status,subClassId,planClassId,createTime,createName)" +
            "values (#{name},#{code},#{status},#{subClassId},#{planClassId},#{createTime},#{createName})")
    void addPlant(BeiJian legalPlantVo1);

    @Insert("insert into beijianperson (beiJiancode,legalPersonCode) values  (#{code},#{legalPersonCode})")
    void addBeiJianPerson(BeiJianAdd beiJianAdd);

    @Update("update LegalPerson set legalPersonName = #{legalPersonName},status = #{status},updateName = #{updateName}," +
            "updateTime = #{updateTime},version = #{version}+1 where id = #{id} and version=#{version}")
    int updatePlant(BeiJian beiJian);

    @Update("update beijian set status = #{status}," +
            "updateName = #{updateName},updateTime = #{updateTime} where id = #{id}")
    void updateStatus(BeiJian legalPlant1);

    @Select("select * from subClass")
    List<SubClass> subClassQuery();
    @Select("select * from planClass")
    List<PlanClass> planClassQueryAll();

    @Select("select * from beijian where code = #{code}")
    BeiJianAdd queryByCode(BeiJianAdd beiJianAdd);

    @Select("select * from legalperson ")
    List<LegalPerson> queryPerson();
}
